let aggregate (func, args, times) =
    let rec aggregate_helper = function
        | 0 -> 0.0
        | 1 -> func args
        | n -> 
            let p = n/2 in
            let q = n-p in
            (aggregate_helper p +. aggregate_helper q)
    in aggregate_helper times
;;

(* The reason why I do not use List.length is that it may take some time to execute, but I am not sure. *)
let list (func, args, times) = 
    let rec list_helper n acc =
      if n >= times 
          then acc 
          else list_helper (n+1) ((func args)::acc)
    in
      list_helper 0 []
;;
